package TestExercises05;

import java.io.File;
import java.io.IOException;

//File文件练习1
/*
需求:
    在当前模块下的aaa文件夹中创建一个a.txt文件
 */
public class Test01 {
    public static void main(String[] args) throws IOException {

        //1、创建a.txt的父级路径
        File file = new File("aaa");
        //2、创建父级路径
        file.mkdirs();

        //3、拼接父级路径和子级路径
        File src = new File(file, "a.txt");
        boolean b = src.createNewFile();
        if (b) {
            System.out.println("创建成功！");
        } else {
            System.out.println("创建失败！");
        }

        boolean delete = src.delete();
        System.out.println(delete);

        boolean delete1 = file.delete();
        System.out.println(delete1);
    }
}
